package com.kaoyaya.delivery.activity;

import java.util.ArrayList;
import java.util.List;

import android.app.Activity;
import android.app.Application;
import android.app.Service;

public class ActivityApp extends Application {
	
	private List<Activity> activitys = new ArrayList<Activity>();
	public List<Service> services = new ArrayList<Service>();

	// 每个Activity创建之前都调用此方法，为保存创建过的Activity
	public void addActivity(Activity act) {
		activitys.add(act);
	}

	public void addService(Service service) {
		services.add(service);
	}

	// 结束掉所以的Activity
	public void finishAll() {
		for (Activity act : activitys) {
			if (!act.isFinishing()) {
				act.finish();
			}
		}
	}
}
